.class public final Lcom/burstly/lib/feature/FeatureFactory;
.super Ljava/lang/Object;
.source "FeatureFactory.java"


# static fields
.field private static final APPTRACK_FEATURE_ID:Ljava/lang/String; = "apptracking"

.field private static final CONTEXT_NAME:Ljava/lang/String; = "config.xml"

.field private static final CURRENCY_FEATURE_ID:Ljava/lang/String; = "currency"

.field private static final DEBUG_FEATURE_ID:Ljava/lang/String; = "debug"

.field private static final DTRACKER_FEATURE_ID:Ljava/lang/String; = "dtracker"

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = "FeatureFactory"

.field private static sContext:Lorg/springframework/context/support/AbstractApplicationContext;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 38
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/feature/FeatureFactory;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 78
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 79
    return-void
.end method

.method public static getAdaptorFactoryFeature(Ljava/lang/String;)Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    .locals 1
    .parameter "networkName"

    .prologue
    .line 101
    const-class v0, Lcom/burstly/lib/feature/networks/IAdaptorFactory;

    invoke-static {p0, v0}, Lcom/burstly/lib/feature/FeatureFactory;->getFeature(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/feature/networks/IAdaptorFactory;

    return-object v0
.end method

.method public static getAppTrackerFeature()Lcom/burstly/lib/feature/apptracker/IAppTracker;
    .locals 2

    .prologue
    .line 119
    const-string v0, "apptracking"

    const-class v1, Lcom/burstly/lib/feature/apptracker/IAppTracker;

    invoke-static {v0, v1}, Lcom/burstly/lib/feature/FeatureFactory;->getFeature(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/feature/apptracker/IAppTracker;

    return-object v0
.end method

.method public static getCurrencyFeature()Lcom/burstly/lib/feature/currency/ICurrencyManager;
    .locals 2

    .prologue
    .line 128
    const-string v0, "currency"

    const-class v1, Lcom/burstly/lib/feature/currency/ICurrencyManager;

    invoke-static {v0, v1}, Lcom/burstly/lib/feature/FeatureFactory;->getFeature(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/feature/currency/ICurrencyManager;

    return-object v0
.end method

.method public static getDTrackFeature()Lcom/burstly/lib/feature/dtracker/IDownloadTracker;
    .locals 2

    .prologue
    .line 110
    const-string v0, "dtracker"

    const-class v1, Lcom/burstly/lib/feature/dtracker/IDownloadTracker;

    invoke-static {v0, v1}, Lcom/burstly/lib/feature/FeatureFactory;->getFeature(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/feature/dtracker/IDownloadTracker;

    return-object v0
.end method

.method private static getFeature(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
    .locals 7
    .parameter "featureId"
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Ljava/lang/String;",
            "Ljava/lang/Class",
            "<TT;>;)TT;"
        }
    .end annotation

    .prologue
    .line 140
    .local p1, featureClass:Ljava/lang/Class;,"Ljava/lang/Class<TT;>;"
    :try_start_0
    sget-object v1, Lcom/burstly/lib/feature/FeatureFactory;->sContext:Lorg/springframework/context/support/AbstractApplicationContext;

    invoke-virtual {v1, p0, p1}, Lorg/springframework/context/support/AbstractApplicationContext;->getBean(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 147
    :goto_0
    return-object v1

    .line 142
    :catch_0
    move-exception v0

    .line 143
    .local v0, exception:Ljava/lang/Exception;
    sget-object v1, Lcom/burstly/lib/feature/FeatureFactory;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v2, "FeatureFactory"

    const-string v3, "Error retrieving feature with id:{0} and class name: {1}. Check configuration file."

    const/4 v4, 0x2

    new-array v4, v4, [Ljava/lang/Object;

    const/4 v5, 0x0

    aput-object p0, v4, v5

    const/4 v5, 0x1

    invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v6

    aput-object v6, v4, v5

    invoke-virtual {v1, v2, v3, v4}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 145
    sget-object v1, Lcom/burstly/lib/feature/FeatureFactory;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v2, "FeatureFactory"

    invoke-virtual {v1, v2, v0}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 147
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public static init(Landroid/content/Context;)V
    .locals 5
    .parameter "context"

    .prologue
    const/4 v4, 0x0

    .line 87
    sget-object v0, Lcom/burstly/lib/feature/FeatureFactory;->sContext:Lorg/springframework/context/support/AbstractApplicationContext;

    if-nez v0, :cond_0

    .line 88
    sget-object v0, Lcom/burstly/lib/feature/FeatureFactory;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "FeatureFactory"

    const-string v2, "Initilizing feature factory..."

    new-array v3, v4, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 89
    new-instance v0, Lcom/burstly/lib/feature/LazyXmlApplicationContext;

    const-string v1, "config.xml"

    invoke-direct {v0, p0, v1}, Lcom/burstly/lib/feature/LazyXmlApplicationContext;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    sput-object v0, Lcom/burstly/lib/feature/FeatureFactory;->sContext:Lorg/springframework/context/support/AbstractApplicationContext;

    .line 90
    sget-object v0, Lcom/burstly/lib/feature/FeatureFactory;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "FeatureFactory"

    const-string v2, "Initilizing feature factory completed."

    new-array v3, v4, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 92
    :cond_0
    return-void
.end method
